Arexx (18/45)

From:Craig Hutchison
Date:4 Sep 2001 at 10:24:26
Subject:Re: Starting programs, waiting for execution

G'day Fritsch,

On 04-Sep-01, you wrote:

FA> But...

FA> there are some more problems. Whats the recommended way of starting
FA> an external program? At the moment I must start Movieshop and ADPro
FA> manually before running the ARexx-script. Can that be done automatically
FA> by the script?

Of course. I do exactly that with some of my YAM scripts.

If ~SHOW('P','YAM') THEN DO /* if we find the YAM port, don't do it */
Say = 'YAM is not running: Opening it NOW!'
Address Command 'Run <>NIL: YAM:YAM'
YAMLoaded = 0 /* YAM isn't running */
Count = 0 /* attempt #1 */
DO UNTIL YAMLoaded /* do it */
Call DELAY(200) /* wait for YAM */
IF SHOW('P','YAM') THEN YAMLoaded = 1
Else do /* still no, try again */
Count = Count + 1 /* attempt number */
If Count = 5 then do /* too many tries */
Say = 'YAM will NOT run. Exiting!' /* Damn! bye bye..... */
EXIT 20
End
End
End
End

Note that YAM's ARexx port is called 'YAM'.

The Show('P') function should be followed by the ARexx port name of
the program you're attempting to run.

Try typing "rx 'say showlist(p)'" into a shell window to find your ARexx
port names.

FA> I also seem to have timing/synchronizing problems with my programs.
FA> So I must wait some time after creating a movieshop-scene in my
FA> ARexx-Script before I can instruct movieshop to gotoFirstFrame, Mark
FA> Frame, Copy, Export. Without any delay the first command after "record"
FA> failes. So I wrote a delay-function (or is there a build-in
FA> ARexx-Delay-Funktion?) and wait a moment after record scene. The same
FA> problem seems to be in ADPro. It seems I have to wait after "Save-Image"
FA> before I can start the PutClient.

See the Delay() function above. Delay(50) = 1 second

FA> Is there a synchronizing mechanism in ARexx or is the command
FA> usually *really* finished before arexx executes the next line?

ARexx normally executes a single line at a time.

FA> With my delay-loops (call TIME() until some seconds are over) the
FA> script looks very bad. I would prefere proper execution without
FA> hand-optimized-delay-loops.

FA> And finally: whats the best way to wait for instance 10 Minutes? The
FA> polling of Time() cannot be the best way I suppose.

I'd recommend a cron program like TPTCron or CyberCron. Both are on
Aminet in util/time. Simply set the cron program running from your
SUS (or User-Startup) and add your ARexx script to the crontab
(configuration) file to execute every ten minutes.

Cache Ya,
Craig.

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Secure your servers with 128-bit SSL encryption! Grab your copy of VeriSign's FREE Guide: "Securing Your Web Site for Business." Get it Now!
http://us.click.yahoo.com/n7RbFC/zhwCAA/yigFAA/saFolB/TM
---------------------------------------------------------------------~->

ARexx mailing list - No flames, no overquoting, no crossposting.
Unsub: Blank mail to mailto:arexx-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/